<?php
class ui_circle_action_member_manager extends ui {
	/**
	 * @param object $S
	 * @param array $param	= array (
	 * 			type			// remove / to_admin / to_normal
	 * 			circle_id
	 * 			members
	 * )
	 */
	public function __construct($S, $param) {
		parent::__construct();
		$data_circle = new data_circle();
		
		switch ($param['type']) {
			case 'remove':
				$data = $data_circle->remove_member($this->uid, $param['circle_id'], $param['members']);
				break;
			case 'to_admin':
				$data = $data_circle->set_member_admin($this->uid, $param['circle_id'], $param['members'], true);
				break;
			case 'to_normal':
				$data = $data_circle->set_member_admin($this->uid, $param['circle_id'], $param['members'], false);
				break;
			default :
				return false;
		}
		if ($data) {
			$S->assign('data', 'true');
		} else {
			$S->assign('data', 'false');
		}
	}
}
?>